package cc.common.net;

import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLSocketFactory;

import okhttp3.OkHttpClient;

/**
 * 网络管理单例。
 */
public class HttpManager {

    private OkHttpClient okHttpClient;

    private HttpManager() {
        okHttpClient = new OkHttpClient.Builder().sslSocketFactory(SSLSocketClient.getSSLSocketFactory()).callTimeout(20, TimeUnit.SECONDS).build();
    }

    public OkHttpClient getOkHttpClient() {
        return okHttpClient;
    }

    public static HttpManager getInstance() {
        return InnerClass.manager;
    }

    private static class InnerClass {
        static HttpManager manager = new HttpManager();
    }
}
